home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / A-line / Scripts / SnapShot < prev    next >
Encoding:
Text File  |  2000-06-24  |  1.6 KB  |  76 lines

  1. # SnapShot
  2.  
  3. If "{1}" == "--verbose"
  4.     Set VERBOSE "yup"
  5.     Shift
  6. End
  7.  
  8. If "`Exists -d "{1}"`" != ""
  9.     Set VICTIM `resolvealias "{1}"`
  10.     Set PARENT "{VICTIM}:"
  11. Else If `Exists -f "{1}"` != ""
  12.     Echo "SnapShot: Intended victim '{1}' is a file, which is not supported."
  13.     Echo "Why don't you put it in a folder with a Read Me like any normal person?"
  14.     Exit 1
  15. Else
  16.     Echo "SnapShot: Intended victim '{1}' does not exist (darn)."
  17.     Exit 1
  18. End
  19.  
  20. OutToLunch --express
  21. Set FTP "jjuran:ftp:"
  22. Set DATE `Echo āˆ‚`Date -d -sāˆ‚` | sed "s/[-.]//g"`
  23. Set PLAIN "`BaseName "{VICTIM}"`"
  24. Set SMASHED `Smash "{PLAIN}"`
  25. Set CHOPPED `Echo {SMASHED} | sed "s/-[0-9][.0-9dab]*//g"`
  26. Set OLDNAME "{PLAIN}.sit"
  27. Set NEWNAME "{DATE}-{CHOPPED}.sit"
  28. Set PACKAGE "{NEWNAME}.bin"
  29.  
  30. If {VERBOSE}
  31.     #Echo "Cleaning folder '{PLAIN}'."
  32.     Clean --distclean
  33. End
  34. If {VERBOSE}
  35.     Echo "Archiving folder '{PLAIN}'."
  36.     Echo "> {OLDNAME}"
  37. End
  38. Delete -i "{PARENT}{PLAIN}.sit"
  39. Stuff "{VICTIM}"
  40.  
  41. If {VERBOSE}
  42.     Echo "Renaming archive '{OLDNAME}'."
  43.     Echo "> {NEWNAME}"
  44. End
  45. Rename "{PARENT}{OLDNAME}" "{PARENT}{NEWNAME}"
  46.  
  47. If {VERBOSE}
  48.     Echo "Encoding archive '{NEWNAME}'."
  49.     Echo "> {NEWNAME}.bin"
  50. End
  51. MacBin "{PARENT}{NEWNAME}"
  52.  
  53. If Not "`Exists -d "{PARENT}Snapshots:"`"
  54.     If {VERBOSE}
  55.         Echo "Creating the Snapshots directory."
  56.         Echo "> Snapshots"
  57.     End
  58.     NewFolder "{PARENT}Snapshots:"
  59. End
  60.  
  61. If {VERBOSE}
  62.     Echo "Saving copy of archive for posterity."
  63. End
  64. Move "{PARENT}{NEWNAME}" "{PARENT}Snapshots:"
  65.  
  66. If {VERBOSE}
  67.     Echo "Copying encoded archive to FTP source tree for eventual upload."
  68. End
  69. Duplicate "{PARENT}{PACKAGE}" "{FTP}src:"
  70.  
  71. # Deleting original copy.
  72. Delete "{PARENT}{PACKAGE}"
  73.  
  74. Exit
  75. # The end.
  76.